package com.jboltai.common;
import java.util.ArrayList;
import java.util.List;

/**
 * 频率限制 枚举
 */
public enum AIRateLimitType {
        MIN( "每分钟","min"),
        HOUR("每小时", "hour"),
        DAY("每天","day");
    private String value;
    private String text;
    AIRateLimitType(String text, String value){
        this.text = text;
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public static AIRateLimitType getByValue(String value){
        for(AIRateLimitType item : AIRateLimitType.values()){
            if(item.getValue().equals(value)){
                return item;
            }
        }
        return null;
    }

    public String getTextByValue(String value){
        for(AIRateLimitType item : AIRateLimitType.values()){
            if(item.getValue().equals(value)){
                return item.getText();
            }
        }
        return null;
    }

    public static List<AIRateLimitType> listAll(){
        List<AIRateLimitType> list = new ArrayList<>();
        list.add(MIN);
        list.add(HOUR);
        list.add(DAY);
        return list;
    }
}
